package com.example.studyPlatform.service;

import com.example.studyPlatform.service.protocol.MarkdownService;
import org.commonmark.node.Node;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.HtmlRenderer;
import org.springframework.stereotype.Service;

@Service
public class MarkdownServiceImpl implements MarkdownService {
    HtmlRenderer renderer = HtmlRenderer.builder().build();
    Parser parser = Parser.builder().build();

    @Override
    public String markdownToHTML(String content) {
        Node document = parser.parse(content);
        return renderer.render(document);
    }

    @Override
    public String getMarkdownStyle(String theme) {
        return null;
    }

}
